package com.xenione.libs.swipemaker;

import ohos.agp.components.ScrollHelper;

/**
 * Created by Eugeni on 10/04/2016.
 */
public class ScrollerHelper {

    private ScrollHelper mScroller;

    public ScrollerHelper(ScrollHelper overScroller) {
        mScroller = overScroller;
    }

    public boolean startScroll(int start, int end) {
        if (start == end) {
            return false;
        }
        int delta = end - start;
        mScroller.startScroll(start, 0, delta, 0);
        return true;
    }

    public boolean startScroll(int start, int end, int duration) {
        if (start == end) {
            return false;
        }
        int delta = end - start;
       // mScroller.startScroll(start, 0, delta, 0, duration);
        mScroller.startScroll(start, 0, delta, 0);
        return true;
    }

    public void finish() {
        if (!mScroller.isFinished()) {
//            mScroller.forceFinished(true);
        }
    }

    public boolean isFinished() {
        return mScroller.isFinished();
    }

    public boolean computeScrollOffset() {
        return false;//mScroller.computeScrollOffset();
    }

    public int getCurrX() {
//        return mScroller.getCurrX();
        return mScroller.getScrollDistanceX();
    }

}


